<div class="auth-main">
  <div class="auth-block">
    <h1>登录</h1>
    <form [formGroup]="form" (ngSubmit)="onSubmit(form.value)" class="form-horizontal">
      <div class="form-group row" [ngClass]="{'has-error': (!username.valid && username.touched), 'has-success': (username.valid && username.touched)}">
        <label for="inputEmail3" class="col-sm-2 control-label">用户名</label>

        <div class="col-sm-10">
          <input [formControl]="username" type="username" class="form-control" id="inputEmail3" placeholder="用户名">
        </div>
      </div>
      <div class="form-group row" [ngClass]="{'has-error': (!password.valid && password.touched), 'has-success': (password.valid && password.touched)}">
        <label for="inputPassword3" class="col-sm-2 control-label">密码</label>

        <div class="col-sm-10">
          <input [formControl]="password" type="password" class="form-control" id="inputPassword3" placeholder="密码">
          <span *ngIf="errorMessage" class="help-block sub-little-text">{{errorMessage}}</span>
        </div>
      </div>
      <div class="form-group row">
        <div class="offset-sm-2 col-sm-10">
          <button [disabled]="!form.valid" type="submit" class="btn btn-default btn-auth">登录</button>
        </div>
      </div>
    </form>
  </div>
</div>
